package it.traveldream.customer;
import it.traveldreamClient.beans.ClientManagerInterface;
import it.traveldreamClient.beans.PacchettiMgrBeanInterface;
import it.traveldreamClient.beans.UserMgr;
import it.traveldreamClient.beans.dto.PkgDTO;
import it.traveldreamClient.beans.dto.PkgPersonalDTO;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;

@ManagedBean(name="preferiteMB")
@RequestScoped
public class PreferiteListMangedBean {
	@EJB
	private PacchettiMgrBeanInterface pkg;
	@EJB 
	private UserMgr usr;
	@EJB
	private ClientManagerInterface mk;
	
	
	private List<PkgPersonalDTO> Pacchetti;
	
	private PkgPersonalDTO selectedPacchetto;

	public PreferiteListMangedBean() {
		selectedPacchetto = new PkgPersonalDTO();
	}
		
	@PostConstruct
	public void init(){
		Pacchetti = mk.getPreferiteList(usr.getMailActualUser());
		
	}

	
	
	
	public List<PkgPersonalDTO> getPacchetti() {
		return Pacchetti;
	}

	public void setPacchetti(List<PkgPersonalDTO> pacchetti) {
		Pacchetti = pacchetti;
	}

	public PkgDTO getSelectedPacchetto() {
		return selectedPacchetto;
	}

	public void setSelectedPacchetto(PkgPersonalDTO selectedPacchetto) {
		this.selectedPacchetto = selectedPacchetto;
	}

	public String showPkg(){
		System.out.println("kkkkkkkkkkkkkkkkkkkkkkkkkk"+selectedPacchetto.toString());
		return "/"+usr.getUrlRole()+"/"+"index?faces-redirect=true";
	}

	public PacchettiMgrBeanInterface getPkg() {
		return pkg;
	}

	public void setPkg(PacchettiMgrBeanInterface pkg) {
		this.pkg = pkg;
	}


	public UserMgr getUsr() {
		return usr;
	}

	public void setUsr(UserMgr usr) {
		this.usr = usr;
	}
	
	
	
	
	

}
